﻿CREATE procedure [dbo].[Upload_UpData]
as
declare 
@Uploadlsh bigint =0
select @Uploadlsh = max(Uploadlsh) from Upload
select * into #tempdata from Kqjl_Info where kqlsh > @Uploadlsh or @Uploadlsh is null
if exists(select 1 from #tempdata)
begin
	insert into Upload values (getdate(), (select max(kqlsh) from #tempdata))
end
select * from #tempdata